<template>
    <!--填写法人基本信息-->
  <div class="legal">
    <!--内容-->
    <div class="legal-content">
       <!--标题-->
       <div class="title">
          <span>
            基本信息
          </span>
       </div>
       <!--法人姓名-->
       <Card>
          <div class="c-1">
            <div class="c-x">
              <div class="c-c-x"></div>
              <div class="font">法人姓名</div>
            </div>
            <div class="c-1-1">
              <Input v-model="legal.name"  clearable  placeholder="请输入姓名"></Input>
            </div>
          </div>
       </Card>
       <!--手机号-->
       <Card class="card-2">
          <div class="c-1">
            <div class="c-x">
              <div class="c-c-x"></div>
              <div class="font">手机号</div>
            </div>
            <div class="c-2-1">
              <Input  v-model="legal.phone"  clearable  placeholder="请输手机号"></Input>
            </div>
          </div>
       </Card>
       <!--占股-->
      <Card>
        <div class="c-1">
          <div class="c-x">
            <div class="c-c-x"></div>
            <div class="font">占有股份</div>
          </div>
          <div class="c-1-1">
            <InputNumber
              :max="100"
              :min="0"
              v-model="legal.stock"
              :formatter="value => `${value}%`"
              :parser="value => value.replace('%', '')" >
            </InputNumber>
          </div>
        </div>
      </Card>
      <!--身份证号-->
      <Card class="card-2">
        <div class="c-1">
          <div class="c-x">
            <div class="c-c-x"></div>
            <div class="font">身份证号</div>
          </div>
          <div class="c-2-1">
            <Input  v-model="legal.idCard" clearable  placeholder="请输入身份证号"></Input>
          </div>
        </div>
      </Card>
      <!--邮箱-->
      <Card >
        <div class="c-1">
          <div class="c-x">
            <div class="c-c-x2"></div>
            <div class="font">邮箱</div>
          </div>
          <div class="c-2-1">
            <Input  v-model="legal.email"  clearable  placeholder="请输邮箱"></Input>
          </div>
        </div>
      </Card>

    </div>
    <!--底部-->
    <div class="legal-footer" @click="sure">
        <div class="footer-text">
           确定保存
        </div>
    </div>
  </div>
</template>

<script>
  import { Toast } from 'mint-ui';
    export default {
        name: "legal",
        data() {
            return {
              legal:{
                name:"",
                phone:"",
                type:0,
                stock:0,
                email:"",
                idCard:"",
                str:"",
              }
            };
        },
        methods: {

          sure(){
            if (this.legal.name==""){
              Toast("请填写法人名称");
              return;
            }
            if (this.legal.phone==""){
              Toast("请填写手机号");
              return;
            }
            if (this.legal.stock==0){
              Toast("请填写占股股份");
              return;
            }
            if (this.legal.idCard==""){
              Toast("请填证件号");
              return;
            }
            this.legal.str=this.legal.name+" "+this.legal.phone+" "+this.legal.stock+"%";
            this.$store.commit("cpAddLegals",this.legal);
            this.$router.go(-1);
          }

        },

    }
</script>

<style lang="less" scoped>
@import "./less/legal";
</style>
